Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.Common

Namespace MB.PsychCal.DAL
    Public MustInherit Class DataAccess
        Private _ConnectionString As String = ""
        Public Property ConnectionString() As String
            Get
                Return _ConnectionString
            End Get
            Set(ByVal value As String)
                _ConnectionString = value
            End Set
        End Property

        Private _EnableCaching As Boolean
        Public Property EnableCaching() As Boolean
            Get
                Return _EnableCaching
            End Get
            Set(ByVal value As Boolean)
                _EnableCaching = value
            End Set
        End Property

        Private _CacheDuration As Integer
        Public Property CacheDuration() As Integer
            Get
                Return _CacheDuration
            End Get
            Set(ByVal value As Integer)
                _CacheDuration = value
            End Set
        End Property


        Public ReadOnly Property Cache() As Cache
            Get
                Return HttpContext.Current.Cache
            End Get
        End Property

        Protected Function ExecuteNonQuery(ByVal cmd As System.Data.Common.DbCommand) As Integer
            Return cmd.ExecuteNonQuery()
        End Function
        Public Function ExecuteReader(ByVal cmd As DbCommand, ByVal Behavior As CommandBehavior)
            Return cmd.ExecuteReader(Behavior)
        End Function
        Public Function ExecuteReader(ByVal cmd As System.Data.Common.DbCommand) As System.Data.IDataReader
            Return ExecuteReader(cmd, CommandBehavior.Default)
        End Function
        Public Function executeScalar(ByVal cmd As DbCommand)
            Return cmd.ExecuteScalar
        End Function

    End Class
End Namespace